package com.openlogic.common.logic.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.sql.Clob;
import java.sql.SQLException;

/**
 * @ClassName: ClobConvertUtils
 * @Description: Clob转化为String类型
 * @author weiyongpeng
 * @date 2025年1月23日 下午8:42:37
 */
public class ClobConvertUtils {

	public static String clob2String(Object clob) throws SQLException, IOException {
		String reString = "";
		Reader is = ((Clob) clob).getCharacterStream();// 得到流
		BufferedReader br = new BufferedReader(is);
		String s = br.readLine();
		StringBuffer sb = new StringBuffer();
		while (s != null) {
			// 执行循环将字符串全部取出付值给StringBuffer由StringBuffer转成STRING
			sb.append(s);
			s = br.readLine();
		}
		reString = sb.toString();
		return reString;
	}

}
